//
//  scrollVCell.m
//  HubeiHotel
//
//  Created by LiBenCan on 17/11/20.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "scrollVCell.h"
#import <SDCycleScrollView.h>
#import "WokerViewController.h"
@interface scrollVCell()<SDCycleScrollViewDelegate>
@property (nonatomic,strong)SDCycleScrollView *cycleScrollView;//轮播
@property (nonatomic,strong)NSArray *imageVArr;//图片Arr
@end
@implementation scrollVCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    //    继承父类
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = 0;
    }
    return self;
}
-(void)loadCellWithData:(NSArray *)imageArr
{
    //加载的图片数组
    [self.contentView addSubview:self.cycleScrollView];
    [self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make){
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.height.equalTo(@(180*screenW_6));
        make.top.equalTo(self.contentView).offset(0);
        make.bottom.equalTo(self.contentView).offset(0);
    }];
    self.cycleScrollView.imageURLStringsGroup = imageArr;
}
-(SDCycleScrollView *)cycleScrollView//轮播
{
    if (!_cycleScrollView) {
        _cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0,0,SCREENW,180*screenW_6) delegate:self placeholderImage:[UIImage imageNamed:@"placeholder"]];
        _cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
        _cycleScrollView.currentPageDotColor = [UIColor whiteColor];
        _cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
        _cycleScrollView.autoScrollTimeInterval = 4.0f;
        _cycleScrollView.userInteractionEnabled = YES;
        _cycleScrollView.delegate = self;
    }
    return _cycleScrollView;
}
//轮播图片点击事件
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index;
{
    if (_block) {
        _block(index);
    }
}

@end
